package com.example.controller;

import com.example.common.Result;
import com.example.entity.User;
import com.example.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class WebController {

    @Resource
    private UserService userService;

    /**
     * 默认请求接口
     */
    @GetMapping("/hello")
    public Result hello() {
        return Result.success();
    }

    /**
     * login接口
     */
    @PostMapping("/login")
    public Result login(@RequestBody User user) {
        User dbUser = userService.login(user);
        return Result.success(dbUser);
    }
}
